<%= render(:partial => "shared/flash_message") %>
<%= render :partial => "shared/config_save_actions", :locals => {:scope => {}} -%>
<%= form_for(scope[:material],
            :as => :material, :url => scope[:url],
            :html => {:method => scope[:method],
                      :onsubmit => "return AjaxForm.jquery_ajax_submit(this);",
                      :class => "popup_form"}) do |f| %>
    <%= md5_field %>
    <%= current_tab_field("materials") -%>
    <div class="form_content change_materials">
        <%= render :partial => "admin/shared/global_errors.html", :locals => {:scope => {}} -%>
        <div class="fieldset">
            <div class="form_item">
                <div class="form_item_block">
                    <label>Material Name</label>
                    <%= f.text_field com.thoughtworks.go.config.materials.AbstractMaterialConfig::MATERIAL_NAME, :class => "form_input", :id => nil -%>
                    <%= error_message_on(scope[:material], com.thoughtworks.go.config.materials.AbstractMaterialConfig::MATERIAL_NAME, :css_class => "form_error") %>
                </div>
                <div class="form_item_block required">
                    <label>Pipeline <span class="autocomplete_stage">[Stage]</span><span class="asterisk">*</span></label>
                    <%= f.text_field com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig::PIPELINE_STAGE_NAME, :class => "form_input" -%>
                    <%= error_message_on(scope[:material], com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig::PIPELINE_STAGE_NAME, :css_class => "form_error") %>
                    <div class="autocomplete"></div>
                </div>
              <div class="form_item_block checkbox_row">
                <%= f.check_box(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig::IGNORE_FOR_SCHEDULING, {:class => "form_input"}, "true") -%>
                <%= f.label(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig::IGNORE_FOR_SCHEDULING, 'Do not schedule the pipeline when this material is updated') %>
                <a href='<%= docs_url '/configuration/configuration_reference.html#pipeline-1' %>' target='_blank'>Learn More...</a>
                <%= error_message_on(f.object, com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig::IGNORE_FOR_SCHEDULING, :css_class => "form_error") %>
              </div>
            </div>
            <%= render :partial => 'shared/form_required_message.html', :locals => {:scope => {}} %>

        </div>
    </div>
    <%= render :partial => 'admin/shared/dependency_auto_complete.html', :locals => {:scope => {:pipeline_stages_json => @pipeline_stages_json, :selector => "#material_pipelineStageName"}} %>
    <%= render :partial => "shared/form_buttons.html", :locals => {:scope => {:submit_label => scope[:submit_label]}} unless scope[:read_only_page] %>
<% end %>
